package com.yxhl.zoume.core.tripsmgmt.ui.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.FrameLayout;

import com.yxhl.protobuf.BizOrder;
import com.yxhl.zoume.R;
import com.yxhl.zoume.UIConstants;
import com.yxhl.zoume.common.ui.activity.base.BaseActivityWithToolBar;
import com.yxhl.zoume.core.tripsmgmt.info.CommentEntrance;
import com.yxhl.zoume.core.tripsmgmt.ui.fragment.CommentOnDriverFragment;

import butterknife.BindView;

public class CommentOnDriverActivity extends BaseActivityWithToolBar {

    private static final String TAG = "CommentOnDriverAct";

    @BindView(R.id.toolbar_include_head)
    Toolbar mToolBar;
    @BindView(R.id.frame_activity_comment_on_body)
    FrameLayout commentOnBodyFrame;


    //arguments
    private BizOrder mBizOrder;

    private CommentEntrance mCommentEntrance;

    public static Intent getCallingIntent(Activity activity, BizOrder bizOrder, CommentEntrance entrance) {
        Intent intent = new Intent(activity, CommentOnDriverActivity.class);
        intent.putExtra(UIConstants.TripContainer.INTENT_KEY_COMMENT_ON_DRIVER, bizOrder);
        intent.putExtra(UIConstants.TripContainer.INTENT_KEY_TRIP_COMMENT_ENTRANCE, entrance);
        return intent;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        handleIntent();
        initializeShow();
    }

    private void handleIntent() {
        Intent intent = getIntent();
        if (intent != null) {
            mBizOrder = (BizOrder) intent.getSerializableExtra(UIConstants.TripContainer.INTENT_KEY_COMMENT_ON_DRIVER);
            mCommentEntrance = (CommentEntrance) intent.getSerializableExtra(UIConstants.TripContainer.INTENT_KEY_TRIP_COMMENT_ENTRANCE);
        }
    }

    private void initializeShow() {
        CommentOnDriverFragment commentOnDriverFragment = CommentOnDriverFragment.newInstance(mBizOrder, mCommentEntrance);
        addFragment(R.id.frame_activity_comment_on_body, commentOnDriverFragment);
    }


    @Override
    public void onBackPressed() {
        super.onBackPressed();
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_comment_on_driver;
    }

    @Override
    protected void initializeInjector() {

    }

    @Override
    protected void onHeaderLeftClick(View view) {
        onBackPressed();
    }

    @Override
    protected void onHeaderRightClick(View view) {

    }

}
